package edu.nanyang.struts;

import com.opensymphony.xwork2.ActionSupport;

import edu.nanyang.domain.User;
import edu.nanyang.hibernate.service.IUserService;

public class UserAction extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private IUserService userService;
	private int userId;
	private String password;
	private String password1;
	private String telephone;
	private String result;
	private String lockType;
	public String modifyPersonalInfo(){
		User u=new User();
		u.setId(userId);
		u.setPassword(password);
		u.setRepassword(password1);
		u.setTelephone(telephone);
		result=this.userService.updateUser(u);
		return SUCCESS;
	}
	public String lockUser(){
		if(this.userService.lockUser(userId, lockType)){
			if("YES".equals(lockType)){
				result="锁定用户成功";
			}else{
				result="激活用户成功";
			}
		}else{
			if("YES".equals(lockType)){
				result="锁定用户失败";
			}else{
				result="激活用户失败";
			}
		}
		return SUCCESS;
	}
	
	public String getLockType() {
		return lockType;
	}

	public void setLockType(String lockType) {
		this.lockType = lockType;
	}

	public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getTelephone() {
		return telephone;
	}
	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
	public void setUserService(IUserService userService) {
		this.userService = userService;
	}
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	public String getPassword1() {
		return password1;
	}
	public void setPassword1(String password1) {
		this.password1 = password1;
	}
	
}
